﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CommonMvc.Common;
using CommonMvc.Controllers;
using CommonMvc.Models.Concreate;
using CommonMvc.Models.Sys;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Distributed;

namespace CommonMvc.Areas.Sysmanager.Controllers
{
    [Area("Sysmanager")]
    public class MenuController : BaseController
    {
        public MenuController(DataContext context, IWorkContext workContext, IDistributedCache distributedCache)
          : base(context, workContext, distributedCache)//依赖注入得到实例  
        { }
        public IActionResult Indexhello()
        {
            return View();
        }

        public IActionResult AddMenu(Menu menuItem) {
            Menu menuTest = new Menu
            {
                Name = "代码添加",
                Url = "url",
                Icon = "图标",
                ViewPermission = "controller|action",
                ParentId = 0,
                SortNo = 0,
                Memo = "备注",
                State = 0
            };
            _dataBaseContext.Menus.Add(menuTest);
            _dataBaseContext.SaveChanges();
            return Content("");
        }
    }
}